package com.nbsaas.boot.product.data.entity;

import com.nbsaas.boot.code.annotation.FieldConvert;
import com.nbsaas.boot.code.annotation.FieldName;
import com.nbsaas.boot.code.annotation.FormAnnotation;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import com.nbsaas.boot.jpa.data.entity.LongEntity;
import lombok.Data;

import jakarta.persistence.*;
import org.hibernate.annotations.Comment;


@Data
@FormAnnotation(title = "规格值管理",model = "规格值")
@Entity
@Table(name = "nb_product_spec_value")
public class ProductSpecValue extends LongEntity {

    @Column(length = 20)
    private String name;

    @JoinColumn(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
    @FieldConvert
    @FieldName
    @ManyToOne(fetch = FetchType.LAZY)
    private ProductSpec spec;

    @Comment("商品id")
    private Long productId;
}
